<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1 class="h1"></h1>
    <script>
        var h1 = document.querySelector(".h1");
        var to = 100;
        for(var i=0;i<to;i++){
            (function(n){
                setTimeout(function(){
                    console.log(n);
                },n*1000);
            })(i);
        }
    </script>
</body>
</html>